package cn.tedu.mybatis.mapper;

import cn.tedu.mybatis.pojo.Comment;
import cn.tedu.mybatis.pojo.CommentVO1;
import cn.tedu.mybatis.pojo.CommentVO2;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CommentMapper {
    //@Insert("INSERT INTO comment(content,created,user_id,blog_id) VALUES (#{content},#{created},#{userId},#{blogId})")
    int insertComment(Comment comment);
    //@Delete("DELETE FROM comment WHERE id=#{id}")
    int deleteCommentById(Integer id);
    //@Update("UPDATE comment SET content=#{content},created=#{created},user_id=#{userId},blog_id=#{blogId} WHERE id=#{id}")
    int updateCommentById(Comment comment);
    //@Select("SELECT content,user_id userId FROM comment WHERE id=#{id}")
    CommentVO1 selectCommentById(Integer id);
    //@Select("SELECT id,content,user_id userId FROM comment WHERE user_id=#{id}")
    List <CommentVO2>selectCommentByUserId(Integer id);


}
